<template>
	<div class="design-data-grid-component" @click.stop="onClickHandler" :class="[selected ?'design-data-grid-component-selected' : 'design-data-grid-component']" style="position: relative;">
		<i class="el-icon-rank drag-widget" style="position: absolute;left: 0px;top:0px;z-index: 100;" v-show="selected"></i>
		<slot></slot>
	</div>
</template>

<script>
	import utils from '@/utils/utils.js';
	import formDesignerUtil from '@/utils/formDesignerUtil.js';
	export default {
		name: "DesignDataGridComponent",
		props: [
			"componentModel"
		],
		data() {
			return {
				selected:false,
				"propertySet": [
					{
						"key": "ID","label":"ID","editor":"label"
					},
					{
						"key": "dataSource","label":"数据源","editor":"select"
					},
					{
						"key": "pageable","label":"分页","editor":"checkbox"
					},
					{
						"key": "onPagination","label":"分页事件","editor":"textarea"
					}
				]
			}
		},inject:['children'],
		mounted() {
			this.children.push(this);
		},beforeUnmount() {
			utils.removeArrayElement(this.children,this);
		},
		methods: {
			onClickHandler(){
				formDesignerUtil.mobileComponentClickHandler(this);
			},setSelected(selected){
				this.selected=selected;	
			},getPropertyValue(propertyKey){
				if (propertyKey == "ID") {
					return formDesignerUtil.getComponentModelPropValue(this.componentModel,"id");
				}
				return formDesignerUtil.getComponentModelCommonValue(this.componentModel,propertyKey);
			},setPropertyValue(propertyKey,propertyValue){
				formDesignerUtil.setComponentModelCommonValue(this.componentModel,propertyKey, propertyValue);
			}
		}
	}
</script>

<style>

</style>
